home *** CD-ROM | disk | FTP | other *** search
- Path: nut.trin.cam.ac.uk!jad1002
- From: jad1002@cam.ac.uk (James Dennett)
- Newsgroups: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2
- Subject: Re: Hungarian notation
- Date: Thu, 8 Feb 1996 10:26:08
- Organization: University of Cambridge, England
- Message-ID: <jad1002.31.000A6FDA@cam.ac.uk>
- References: <4cud8f$gup@news.netvision.net.il> <4dttefINNo29@keats.ugrad.cs.ubc.ca> <Pine.HPP.3.91.960122145028.27524A-100000@clear.cs.byu.edu> <dewar.822407363@schonberg> <Pine.HPP.3.91.960124References: <30C40F77.53B5@swsbbs.com> <4bd <4cc2b2$11jq@navajReferences: <4cud8f$gup@news.netvision.net.il> <4dttefINNo29@keats.ugrad.cs.ubc.ca> <Pine.HPP.3.91.960122145028.27524A-100000@clear.cs.byu.edu> <dewar.822407363@schonberg> <Pine.HPP.3.91.960124References: <30C40F77.53B5@swsbbs.com> <4bd <4cc2b2$11jq@
- rganization: Trinity College, Cambridge
- NNTP-Posting-Host: nut.trin.cam.ac.uk
- X-Newsreader: Trumpet for Windows [Version 1.0 Rev A]
-
- In article <hawkfish-0602960745260001@blv-pm2-ip26.halcyon.com> hawkfish@punchdeck.com (Richard Wesley) writes:
- >From: hawkfish@punchdeck.com (Richard Wesley)
- >Subject: Re: Hungarian notation
- >Date: Tue, 06 Feb 1996 07:45:26 -0800
-
- >In article <Pine.HPP.3.91.960203182917.987A-100000@clear.cs.byu.edu>,
- >Douglas Evan Cook <cookd@cs.byu.edu> wrote:
-
- >>On Wed, 31 Jan 1996, James Dennett wrote:
- >>
- >>> >No, but somebody must have written those methods, no? And that somebody
- >>> >needed to know how many bits each data type is, no? When we changed from
- >>> >16 bit compiler to 32 bit compiler, the data files remained the same.
- >>>
- >>> Herein lies your problem - you broke the ADT. If the ADT didn't specify the
- >>> size of the components then your code can't rely on them...
- >>> so the data files would not necessarily remain the same if
- >>> the implementation of the ADT changed.
- >>
- >>Ah, but the ADT *did* specify that the file format would remain the
- >>same. And not all users of the applications are using the same platforms
- >>- some are running on 386's with 386 DOS extenders, some are running with
- >>286 extenders, some are running on overlaid versions of the program done
- >>for straight DOS, some are running on Windows NT, and some are running on
- >>non Intel based machines. The users expect to be able to transfer files
- >>between each platform. And so we compile, but in each platform we don't
- >>want to have to modify the ADT's because of compiler dependancies. So we
- >>have the ADT's depend on typedef equivalents, so that when we need to
- >>compile for a new platform we only need to change 10-12 lines in the base
- >>definition file.
-
- Do we have a problem here or not?
-
- So, your ADT was relatively concrete and specified the implementation in
- some detail. (Is there a difference between an ADT and a data structure?)
-
- In that case, there's no problem at all; you can of course hide the machine
- dependencies in a module (or just a file) where you would list your typedefs
- if you are happy to forego the optimisations offered by using native types
- for one type of increased portability.
-
- Alternatively, you could use the native integers internally and just write your
- own I/O code. This approach would then be portable to machines of varying
- endian-ness, or even those legendary machines which aren't based on 8-bit
- chunks of memory. The encapsulation can also be made stronger (but then,
- where did encapsulation enter the C philosophy) as these details are all
- within the implementation of the ADT, rather than in a "System Independence"
- module somewhere else.
-
- Each solution may have its place.
-
- >So out of curiosity, how did you handle endian issues (x86s do not use
- >network byte order, unlike most of the rest of the hardware in the known
- >universe)
-
- (Thanks for this point!)
-
- James.
-
- >- rmgw
-
- >http://www.punchdeck.com/hawkfish/PunchDeck.html
-
- >----------------------------------------------------------------------------
- >Richard Wesley | "I don't know about your dreams
- >hawkfish@punchdeck.com | But mine are sort of hackneyed"
- >hawkfish@electricfish.com | - Laurie Anderson, "Talk Normal"
- >----------------------------------------------------------------------------
-
-